define(function(require) {
	var $ = require("jquery");
	var justep = require("$UI/system/lib/justep");

	var Model = function() {
		this.callParent();
		this.url = "http://yun.jiawoltd.com";
		this.nodeId = "";
		this.parent = "";
	};

	Model.prototype.modelParamsReceive = function(event) {
		if (this.params && this.params.nodeId && this.params.parent) {
			this.nodeId = this.params.nodeId;
			this.parent = this.params.parent;
			var scglData = this.comp("scglData");
			scglData.clear();
			$.ajax({
				cache : false,
				type : "GET",
				timeout : 20000, // 超时时间设置，单位毫秒
				url : this.url + "/mobile/getScglData/" + this.nodeId + "/" + this.parent,
				data : {},
				async : false,
				error : function(request) {
				},
				success : function(resp) {
					scglData.loadData(resp);
				}
			});

		}
	};

	Model.prototype.addButtonClick = function(event) {
		justep.Shell.setIsSinglePage();
		var url = './scglAdd.w';
		justep.Shell.showPage(require.toUrl(url), {
			nodeId : this.nodeId,
			parent : this.parent
		});
		justep.Shell.closePage();
	};

	Model.prototype.media1Click = function(event){
		var url = "./sdetail.w"
		justep.Shell.showPage(require.toUrl(url), {
			id : event.bindingContext.$object.val('id'),
			nodeId : this.nodeId,
			parent : this.parent
		});
	};

	return Model;
});